<?php
/**
* Modelo de Usuario
*/
class User extends MY_Model
{
  public function User()
  {
    parent::MY_Model('users', 'id_user', array(
      'group_id'
    ), TRUE);
  }
  
  function get_teachers_and_tas($subject_id)
  {
    return $this->get(array(
      'fields' => 'users.*, us.type as relationship_type, groups.type as group_type, groups.name as group_name',
      'join' => array(
          'users_subjects as us' => 'us.user_id = users.id_user',
          'groups' => 'groups.id_group = users.group_id'
        ),
      'where' => 'us.subject_id = ' . $subject_id . ' AND (us.type = "' . TEACHER . '" OR us.type = "' . TA . '")',
      'order' => 'us.type asc'
    ));
  }
}
